package com.rojored.controls.controlBarClasses 
{

import com.rojored.controls.progressDisplayClasses.BaseProgressDisplay;
import com.rojored.controls.progressDisplayClasses.IFractionDisplay;
import flash.events.Event;

/**
 *  Class that draws a fraction.
 */
public class FractionDisplay extends BaseProgressDisplay 
    implements IFractionDisplay
{

    //--------------------------------------------------------------------------
    //
    //  Constructor
    //
    //--------------------------------------------------------------------------

    /**
     *  Constructor
     */
    public function FractionDisplay() 
    {
        super();
        progressValues[0] = 0;
    }

    //--------------------------------------------------------------------------
    //
    //  Properties
    //
    //--------------------------------------------------------------------------
    
    //--------------------------------------
    //  fraction 
    //--------------------------------------

    /**
     *  @private
     *  Storage for the fraction property
     */
    private var _fraction:Number;
    
    /**
     *  @private
     */
    private var fractionChanged:Boolean;

    [Bindable("fractionChanged")]

    /**
     *  @copy com.rojored.controls.progressDisplayClasses.IFractionDisplay#fraction
     */
    public function get fraction():Number
    {
        return progressValues[0];
    }

    /**
     *  @private
     */
    public function set fraction(value:Number):void
    {
        if (progressValues[0] == value)
            return;

        progressValues[0] = value;
        invalidateDisplayList();
        dispatchEvent(new Event("fractionChanged"));
    }
}
}
